Method and apparatus for occlusion detection on target object, electronic device, and storage medium

ABSTRACT

A method for occlusion detection on a target object is provided. The method includes: determining, based on a pixel value of each pixel in a target image, first positions of a first feature and second positions of a second feature in the target image. The first feature is an outer contour feature of a target object in the target image, the second feature is a feature of an interfering subobject in the target object. The method also includes: determining, based on the first positions, an image region including the target object; dividing, based on the second positions, the image region into at least two detection regions; and determining, according to a pixel value of a target detection region, whether the target detection region meets a preset unoccluded condition, to determine whether the target object is occluded. The target detection region is any one of the at least two detection regions.

CROSS-REFERENCES TO RELATED APPLICATIONS

This application is a continuation application of PCT Patent ApplicationNo. PCT/CN2018/090994, filed on Jun. 13, 2018, claims priority toChinese Patent Application No. 201710625671.0, entitled “METHOD ANDAPPARATUS FOR OCCLUSION DETECTION ON TARGET OBJECT, ELECTRONIC DEVICE,AND STORAGE MEDIUM” filed with the Chinese Patent Office on Jul. 27,2017, the entire contents of both of which are incorporated herein byreference.

FIELD OF TECHNOLOGY

The present disclosure relates to the field of information technologies,and in particular, to occlusion detection.

BACKGROUND OF THE DISCLOSURE

In some cases, an electronic device needs to obtain some imagesincluding a target object. However, sometimes, the target object isobstructed, occluded, or cluttered in a captured image or an imageuploaded by a user. Consequently, the captured or loaded image does notsatisfy a requirement.

In the existing technology, an approach of detecting such an occlusionmay usually be manual screening. Another approach is repeatedlyperforming detection, extraction, and iteration based on image featuresto automatically determine whether a current target object is occluded.With regard to the former approach, it is obvious that manual operationis inefficient, and with regard to the latter approach, althoughautomatic determining is achieved by using an electronic device, thereare still problems such as a large calculation amount and low precision.

SUMMARY

In view of this, embodiments of the present disclosure provide a methodfor occlusion detection on a target object, an electronic device, and astorage medium, thereby resolving problems of a large calculation amountand low precision in occlusion detection.

A first aspect of embodiments of the present disclosure provides amethod for occlusion detection on a target object. The method includes:determining, by an electronic device based on a pixel value of eachpixel in a target image, first positions of a first feature and secondpositions of a second feature in the target image. The first feature isan outer contour feature of a target object in the target image, thesecond feature is a feature of an interfering subobject in the targetobject. The method also includes: determining, based on the firstpositions, an image region including the target object; dividing, basedon the second positions, the image region into at least two detectionregions; and determining, by the electronic device according to a pixelvalue of a target detection region, whether the target detection regionmeets a preset unoccluded condition. The target detection region is anyone of the at least two detection regions. The method also includes:determining, by the electronic device, that the target object isoccluded when the preset unoccluded condition corresponding to any oneof the at least two detection regions is not met; and determining, bythe electronic device, that the target object is not occluded whendetermining that the preset unoccluded condition corresponding to eachof the at least two detection regions is met.

A second aspect of the embodiments of the present disclosure provides anapparatus for occlusion detection on a target object, including: amemory and a processor coupled to the memory. The processor isconfigured to determine, based on a pixel value of each pixel in atarget image. The first feature is an outer contour feature of a targetobject in the target image, the second feature is a feature of aninterfering subobject in the target object. The processor is alsoconfigured to: determine, based on the first positions, an image regionincluding the target object; divide, based on the second positions, theimage region into at least two detection regions; and determine, by theelectronic device according to a pixel value of a target detectionregion, whether the target detection region meets a preset unoccludedcondition. The target detection region is any one of the at least twodetection regions. The processor is also configured to: determine thatthe target object is occluded when the preset unoccluded conditioncorresponding to any one of the at least two detection regions is notmet; and determine that the target object is not occluded whendetermining that the preset unoccluded condition corresponding to eachof the at least two detection regions is met.

A third aspect of the embodiments of the present disclosure provides anon-transitory computer storage medium, storing a computer program. Thecomputer program can, when being executed by a processor, cause theprocessor to perform: determining, based on a pixel value of each pixelin a target image. The first feature is an outer contour feature of atarget object in the target image, the second feature is a feature of aninterfering subobject in the target object. The computer program alsocauses the processor to: determine, based on the first positions, animage region including the target object; divide, based on the secondpositions, the image region into at least two detection regions; anddetermine, by the electronic device according to a pixel value of atarget detection region, whether the target detection region meets apreset unoccluded condition. The target detection region is any one ofthe at least two detection regions. The computer program also causes theprocessor to: determine that the target object is occluded when thepreset unoccluded condition corresponding to any one of the at least twodetection regions is not met; and determine that the target object isnot occluded when determining that the preset unoccluded conditioncorresponding to each of the at least two detection regions is met.

In the method for occlusion detection on a target object, the electronicdevice, and the storage medium provided by the embodiments of thepresent disclosure, according to a first aspect, before occlusiondetection is performed, an image region including an entire targetobject is determined by extracting feature points of the target object,for example, extracting a first feature from a target image. Anon-target object is excluded from interfering with detection on whetherthere is an occlusion in the target object. According to a secondaspect, second positions of a feature of an interfering subobject thatis included by the target object and that interferes with occlusiondetection are extracted, then the entire image region is divided basedon the second positions to obtain respective detection regions, andsubsequently, whether there is interference in each detection region isdetermined individually. In this way, interference from the targetobject itself on occlusion detection can be reduced or excluded, therebyimproving precision of occlusion detection in two aspects of excludinginterference from the non target object and excluding interference fromthe interfering subobject of the target object. According to a thirdaspect, there is no repeated iterative calculation process in adetection process, thereby reducing problems of a large calculationamount and complex calculations caused by iterative calculations,improving a detection effect of occlusion detection, and reducingresource overheads of occlusion detection.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic flowchart of a method for occlusion detection on atarget object according to an embodiment of the present disclosure.

FIG. 2 is a schematic flowchart of a method for occlusion detection on atarget object according to an embodiment of the present disclosure.

FIG. 3 is a schematic diagram of displaying changes of a target imageand a feature tag according to an embodiment of the present disclosure.

FIG. 4 is a schematic diagram of a type of detection region divisionaccording to an embodiment of the present disclosure.

FIG. 5A is a schematic diagram of another type of detection regiondivision according to an embodiment of the present disclosure.

FIG. 5B is a schematic diagram of another type of detection regiondivision according to an embodiment of the present disclosure.

FIG. 6 is a schematic diagram of displaying a replacement promptaccording to an embodiment of the present disclosure.

FIG. 7 is a schematic diagram of displaying an adjustment promptaccording to an embodiment of the present disclosure.

FIG. 8 is a schematic structural diagram of an apparatus for occlusiondetection on a target object according to an embodiment of the presentdisclosure.

FIG. 9 is a schematic structural diagram of an electronic deviceaccording to an embodiment of the present disclosure.

FIG. 10 is a schematic flowchart of a method for occlusion detection ona target object according to an embodiment of the present disclosure.

DESCRIPTION OF EMBODIMENTS

The following further describes the technical solutions of the presentdisclosure in detail with reference to the accompanying drawings of thespecification and specific embodiments.

As shown in FIG. 1 and FIG. 2, some embodiments provide a method forocclusion detection on a target object, including:

Occlusion detection, or obstruction detection, as used herein, may referto detecting any undesired effects on the image of the target objectcaused by environment or other objects. For example, the target objectmay be covered/cluttered by another object or interfered by variantillumination (e.g., stronger lighting at one area of the target objectand darker lighting at another area of the target object).

S110: Determine, based on a pixel value of each pixel in a target image,first positions of a first feature and second positions of a secondfeature in the target image, the first feature being an outer contourfeature of a target object in the target image, the second feature beinga feature of an interfering subobject in the target object, and theinterfering subobject being a subobject that interferes with occlusiondetection and that is in the target object.

S120: Determine, based on the first positions, an image region includingthe target object.

S130: Divide, based on the second positions, the image region into atleast two detection regions.

S140: Determine, according to a pixel value of each detection region,whether a preset unocludded (or unobstructed) condition is met in eachdetection region, determining, for a target detection region, whetherthe target detection region meets the preset unoccluded conditionaccording to a pixel value of the target detection region, and thetarget detection region being any one of the at least two detectionregions.

S150: Determine that there is an occlusion in a corresponding detectionregion when the preset unoccluded condition is not met, determining, forthe target detection region, that there is an occlusion in the targetdetection region if determining that the target detection region doesnot meet the preset unoccluded condition.

The method for occlusion detection on a target object provided by someembodiments may be applied to various electronic devices, and usually,may be applied to a server on a network side, or may be applied to aterminal device providing the target image. The server may be an imageserver uploading an image. The terminal device may be various mobileterminals or fixed terminals such as a mobile phone, a tablet computer,a wearable device, a notebook computer, or a desktop computer. FIG. 2shows that a target image is captured by a capturing terminal, thecapturing terminal sends the target image to a server through theInternet or the like, and after receiving the target image, the serverperforms the step S110 to step S150. An execution body shown in FIG. 2is the server. In some embodiments, the execution body may alternativelybe the capturing terminal itself. The capturing terminal therein may beany electronic device with a camera such as a mobile phone or a tabletcomputer.

In some embodiments, the step S110 may include: inputting the targetimage into a learning model by using a machine learning algorithm or thelike, automatically performing, by the learning model, informationprocessing on the target image, and extracting an image region includingthe target object from the target image, where the target object may bedescribed by feature points of the target object. A feature point of thetarget object may be referred to as a target feature. The targetfeatures herein include: the first feature and the second feature.Usually, in this case, the image region is a large image region that isopen. For example, the target object is a face. The first feature may bean outer contour feature indicating a shape of the face. The secondfeature is a feature of a pre-specified organ in the face. Thepre-specified organ may include at least an organ such as eyebrows,eyes, nose, lips or forehead. The pre-specified organ herein is aspecific example of the foregoing interfering subobject. In conclusion,the second feature is a feature of an interfering subobject.

A left-side image in FIG. 3 is a target image, and a right-side image inFIG. 3 is an image in which feature points corresponding to the firstfeature and the second feature are marked. When the target object is aface, the first feature is a facial outer contour feature. The secondfeature is features of eyes, eyebrows, nose, and mouth.

In some embodiments, the learning model may be a neural network, asupport vector machine, a cascade regression model, or the like obtainedby training by using a training sample marked with a recognition result.For example, the learning model is obtained by using a random forest.

First, in an offline training stage, a large quantity of trainingsamples marked with the target object are collected, and may, forexample, be samples in which positions of the first feature and thesecond feature of the target object are manually marked. The randomforest is a classifier for training and predicating samples by using aplurality of decision trees.

Then, a random forest of a target feature is established according to alocal binary pattern (LBP) of feature points of each feature, andmachine learning is performed the random forest, to obtain parametervalues of all nodes of the random forest. Once a parameter value isdetermined, it is equivalent to that a learning model is determined. TheLBP is an operator used to describe a local texture feature of an image,and has notable advantages such as rotation invariance and gray levelinvariance. If the LBP operator is defined to fall within a 3*3 window,a central pixel value of the window is a threshold, and gray levelvalues of eight neighboring pixels are compared with the central pixelvalue. If a neighboring pixel value is greater than the central pixelvalue, a position of the pixel is marked with 1; otherwise, it is markedwith 0. The window herein includes 3*3=9 pixels. In some embodiment, asize of the window may alternatively be adjusted according to needs. Forexample, the window is adjusted into a 4*4 window.

In an online recognition stage: a target image, such as ato-be-recognized facial image, is processed by using the trainedlearning model, a LBP feature of the target feature is calculated, andthen, the feature is determined by using the random forest trainedbefore, to obtain final positions such as geometric positions of thetarget feature in the image or pixel coordinates of pixels correspondingto the target feature. In some embodiments, the first feature and thesecond feature are extracted by using an Active Shape Model (ASM) basedon shape constraints on the target object or by using Active AppearanceModel (AAM) based on shape constraints and texture constraints on thetarget object, thereby determining the first positions and the secondpositions.

For example, the first positions and the second positions may both bepixel coordinates or geometric positions of corresponding pixels of thecorresponding target feature in the target image.

In some embodiments, Scale-invariant feature transform (SIFT) mayalternatively be used to extract the first positions corresponding tothe first feature and the second positions corresponding to the secondfeature.

After the first positions are extracted, a position of the target objectin the target image may be determined based on the first positions,thereby determining an image region corresponding to the target object.

After the second positions are extracted, the image region may bedivided into at least two detection regions based on the secondpositions. During specific implementation, the image region is dividedinto several sub-regions based on the second positions, and eachsub-region is referred to as a detection region.

For example, in some embodiments, each sub-region includes theinterfering subobject. That is, each detection region may include theinterfering subobject. In some other embodiments, each interferingsubobject may be directly taken off. In this way, none of the detectionregions includes the interfering subobject.

Optionally, the step S120 may include:

connecting first positions of the first feature in series to obtain aclosed image region.

Correspondingly, the step S130 may include:

connecting the second positions (e.g., multiple pixels at the secondpositions) in series, to obtain a dividing line for dividing the imageregion, so that the dividing line and an edge line of the image regioncan be combined into at least two closed detection regions not includingthe interfering subobject.

FIG. 4 shows that: when the target object is a face, and the interferingsubobject is an organ of the face, an image region including the face isdivided into detection regions based on distribution of organs. Thedetection region shown in FIG. 4 includes an image part of an organ suchas eyebrows or lips.

FIG. 5A and FIG. 5B show that: when the target object is a face, and theinterfering subobject is an organ of the face, a detection region notincluding an interfering subobject is formed after the interferingsubobject is directly taken off.

Dashed line blocks in FIG. 4, FIG. 5A and FIG. 5B represent acorresponding image region when the face is used as the target object.In the image shown in FIG. 4, the image region corresponding to the faceis divided into two regions: a left cheek detection region (line-shadingarea) and a right cheek detection region (meshed area). In other words,the left cheek detection region and the right cheek detection can beextracted from the image region based on the identified feature points.In some other embodiments, the image region may be divided into a leftface region and a right face region.

In the image shown in FIG. 5A, the image region corresponding to theface (e.g., a region formed by the contour line of the face) is dividedinto three regions: a forehead detection region (dotted area) includingforehead, a left cheek detection region (line-shading area) includingleft cheek, and a right cheek detection region (meshed area) includingright cheek. Similarly, in the image shown in FIG. 5B, in a practicalexample three regions (forehead detection region, left cheek detectionregion, and right cheek detection region) are identified based on thefeature points shown, excluding interfering subobjects such as eyes,nose and lips.

The detection regions can be formed by connecting some pixels of thesecond positions (and sometimes with some pixels of the firstpositions). For example, the left cheek detection region can be formedby sequentially connecting feature points representing lower edges ofthe left eye, feature points representing left side of the nose, andfeature points representing left side of the lips to form a connectedcountour line Further, the connected contour line obtained from thesecond positions may be connected with contour points of the targetobject (e.g., feature points at first positions representing left sideface contour) or contour points of the target image (e.g., left andbottom edge of the image) to form a closed region.

Each detection region is a sub-region of the image region including thetarget object.

In conclusion, there are many manners of dividing the image region intoat least two detection regions. This is not limited to any foregoingone.

In step S140, for a target detection region, whether the targetdetection region meets occluded the preset unoccluded condition isdetermined according to a pixel value of the target detection region. Insome embodiments, the pixel value may be a color value, such as a red,green, blue (R, G, B) value, of a pixel included in the target detectionregion. During implementation, the pixel value of the target detectionregion may be all pixel values or some pixel values in the targetdetection region.

In addition to the face, the target object may be a half human body or afull human body. Therefore, the target image may be a facial image, ahalf-length portrait, or a full-length portrait.

In some embodiments, the target image may alternatively be an imageincluding another target object. For example, a surveillance imageincludes an imaged image of a vehicle.

In some embodiments, the interfering subobject may be an image part thatinterferes with detecting whether the target object is occluded by anocclusion. In some embodiments, the detection region is obtained bydetermining the second positions and dividing the image region. Imageprocessing is performed based on the detection region, to determinewhether there is an occlusion in the detection region, and compared withperforming processing through repeated iterations in the existingtechnology, has features of a small calculation amount and a highprocessing speed. In addition, interference of the target object itselfon detecting whether there is an occlusion is excluded by processing thesecond positions corresponding to the interfering subobject, so thatdetermining precision is improved.

In some embodiments, if whether the target object is occluded isdetermined based on the color feature, the interfering subobject that isin the target object and that interferes with occlusion determining isan image element having a color similarity with an occlusion. Forexample, when the target object is a face, features of five organs areobviously different from a feature of skin, and an occlusion is usuallydifferent from the feature of skin. In this case, with respect to skin,five organs are interfering subobjects having a color similarity withthe occlusion. Five organs of a human herein may include: eyebrows,eyes, mouth, nose, and ears.

In some other embodiments, if whether the target object is occluded isdetermined based on the shape feature, the interfering subobject that isin the target object and that interferes with occlusion determining isan image element having a shape similarity with an occlusion. Forexample, the target object is a human body, and a pattern on a cloth ofa photographed person may be an interfering subobject having a shapesimilarity with an occlusion. For example, if a photographed person Awears a coat having a model of an airplane pattern. How to specificallydetermine whether the airplane pattern is a pattern on the cloth or anocclusion pattern outside the cloth is not determined. Therefore, inthis case, an impact of a pattern on a cloth needs to be eliminated. Theimpact on determining whether there is an occlusion is eliminated, toobtain a more precise result.

Optionally, the method further includes:

obtaining attribute information of the target object, where theattribute information includes overall attribute information and/orregional attribute information, the overall attribute information isused to represent an overall attribute of the target object, and theregional attribute information is used to represent a regional attributeof the detection region;

determining, according to the attribute information, a determining basisparameter and/or a determining policy, where

the determining, for a target detection region, whether the targetdetection region meets the preset unoccluded condition according to apixel value of the target detection region includes at least one of thefollowing:

determining, according to the determining basis parameter and the pixelvalue of the target detection region, whether the target detectionregion meets the preset unoccluded condition; and

determining, based on the pixel value of the target detection region,whether the target detection region meets the preset unoccludedcondition by using the determining policy.

The overall attribute information may include type information of thetarget object, for example, whether the target object is a face, a fullbody, or a half body, an animal image, a vehicle image, or the like.

For using an overall or partial human body as a target object using, theoverall attribute information may include gender information, ageinformation, or the like. For example, males are different from femalesin terms of a proportion of an area of five organs to an area of face.For example, eyes of a female are relatively large, and eyes of a maleare relatively small. For example, adults are also different fromchildren in terms of the proportion. For example, an adult male may havea large area of skin on the forehead part because of a reason such asbaldness, and a child may have a feature of extremely small foreheadbecause of thick hair and a low hairline. Therefore, in someembodiments, a determining basis parameter and/or a determining policyis determined according to the overall attribute information.

The regional attribute information reflects a feature of a correspondingdetection region. For example, different detection regions includedifferent interfering subobject s, and the interfering subobjectsinterfere with occlusion detection in different ways. For example, theregional attribute information herein may be a parameter such as a typeof the interfering subobject.

In some embodiments, if the target object is a face and eyes andeyebrows are both classified into a forehead detection regioncorresponding to forehead, while nose and mouth are dividedhalf-and-half into a left cheek detection region and a right cheekdetection region. In some embodiments, different ratios of an area ofskin to an area of the entire region need to be distinguished.Therefore, during determining, determining may be performed based ondifferent area thresholds.

Different target objects may correspond to different determiningpolicies, for example, determining is performed based on a color orbased on a shape.

In conclusion, in some embodiments, first, a determining basis parameterand/or a determining policy is determined based on at least one ofoverall attribute information and regional attribute information. Inthis way, whether there is an occlusion in each detection region can beprecisely determined by using the corresponding determining basisparameter and/or determining policy.

In some embodiments, the determining basis parameter includes at least:an extreme value used to determine whether a specific detection regionis occluded or an interval value used to determine whether a specificdetection region is occluded.

Certainly, the above are merely examples, and during specificimplementation, it is not limited to any one of the foregoing values.

Optionally, the step S140 may include:

determining a detection ratio of a quantity of pixels that are in thetarget detection region and that have pixel values in a same range to atotal quantity of all pixels in the target detection region;

comparing the detection ratio with a preset ratio of the targetdetection region; and

determining that there is an occlusion in the target detection region ifthe detection ratio is less than the preset ratio.

For example, the pixel value may be a color value, such as an RGB value,a quantity of pixels located in a same range is determined, and being ina same range herein may indicate that: all pixels whose differencestherebetween fall within a preset difference range may be pixels in asame range. A ratio of quantity of the quantity of pixels to a totalquantity of all pixels in the target detection region is obtained. Theratio of quantity herein may be the detection ratio. The preset ratiomay be a predetermined empirical value or simulation value.

Therefore, in some embodiments, the detection ratio in each detectionregion is computed, and then, the detection ratio of the detectionregion is compared with a corresponding preset ratio, to determinewhether the detection region is occluded.

In some embodiments, whether there is an occlusion in the detectionregion can be easily calculated by simply computing a pixel value ofeach detection region and a ratio. Compared with performing repeatediterations and calculations on a large quantity of pixels, someembodiments has features of a small calculation amount, a small quantityof consumed calculation resources, and a high determining speed.

Optionally, different detection regions correspond to different presetratios.

In some embodiments, alternatively, according to a feature of eachdetection region, a preset ratio capable of reflecting an originalfeature of the detection region is provided. In this way, duringdetermining of the target image, compared with using a unified presetratio, whether there is an occlusion in each detection region can bedetermined more precisely, thereby further improving precision ofocclusion determining.

Specifically, with regard to how to perform determining, severaloptional manners are provided with reference to any one of the followingembodiments:

Optional manner 1:

The step S140 may specifically include:

obtaining, based on a pixel value of an edge pixel of the targetdetection region, a shape feature of the target detection region, anddetermining whether the shape feature corresponds to a preset shape.

For example, the target object is a half-length portrait of a person. Ifa pattern or shape on a wear, such as a cloth, of the person has asimilarity with an occlusion that actually obstruct the body of theperson. For example, both of the pattern or shape and the occlusion havea relatively sharp line. However, the occlusion on the cloth may becurved with the cloth, but the actual occlusion would not be curved.Therefore, in step S110, the line features are detected in a manner suchas edge feature detection, and then, in step S130, whether a linefeature is inside a cloth or outside a cloth or is located inside aboundary framed by a human body boundary or outside the boundary isdetermined based on a curvature of the line feature. In step S140,detection region division may be performed according to a curvaturebased on the lines, and then detection is performed, or determining maybe performed based on being inside or outside of the boundary.

Optional manner 2:

The step S140 may include:

determining, based on a pixel value of each pixel in the targetdetection region, a color feature in the target detection region, anddetermining whether the color feature meets a preset color condition.

For example, based on a pixel value of each pixel of the targetdetection region, if it is determined that a large quantity of pixelswith non-skin tone color values appear at positions where a skin toneshould appear, the pixels may an occlusion, and the occlusion appears inthe corresponding target detection region, and consequently, obstructthe target detection region.

Optionally, the method further includes at least one of the following:

outputting, according to an occluded detection region, an adjustmentprompt corresponding to the detection region if the electronic device isin a capturing mode of capturing the target image and detects that thetarget object is occluded; and

outputting a replacement prompt for the target image if the electronicdevice is in a non-capturing mode and detects that the target object isoccluded.

If the electronic device is currently in a real-time obtaining state,for example, a user is using a computer to capture a passport-stylepicture or uploading a head portrait picture to a public serviceplatform (for example, a household registration management platform or apublic security system platform), and if the forehead of the user isoccluded by hair or the user is photographed with sunglasses, obviously,pictures taken in this way do not satisfy requirements. Therefore, insome embodiments, step S110 to step S140 are performed, to determinethat at least a particular detection region is occluded, and then, anadjustment prompt is output to prompt the user to move the hair orremove the sunglasses before taking another picture, thereby reducing aproblem that photographing needs to be repeatedly performed after apicture upload to a corresponding system is identified as unqualified.

For example, if the electronic device is only in a uploading mode,currently, no camera is enabled to capture an image. Generally, it isnecessary to determine whether an uploaded picture are qualified, and abackend server needs to be dedicated to examination, or backendpersonnel need to perform examination manually. Such examinationrequires the user to log in again, cannot perform feedback timely, andcannot notify the user timely either. However, in some embodiments,because step S110 to step S140 can be performed quickly, feedback may bemade to the user timely, and the user is notified timely of areplacement prompt.

If the method for occlusion detection on a target object provided insome embodiments is applied to a network-side server, as shown in FIG.2, the server may alternatively return an adjustment prompt or areplacement prompt to the capturing terminal.

FIG. 6 is a schematic diagram of displaying a replacement prompt. FIG. 7is a schematic diagram of displaying an adjustment prompt. Duringspecific implementation, the replacement prompt and the adjustmentprompt may alternatively be output in a voice form.

In some other embodiments, the method further includes:

determining, by the electronic device according to an occluded status ofthe target image, whether an unoccluded replacement image can bereconstructed based on the target image if the electronic device is inan automatic reconstruction mode and detects that the target object isoccluded; and

generating the replacement image based on the target image if anunoccluded replacement image can be reconstructed based on the targetimage.

Although an image and/or a video frame uploaded by a user does not meetthe unoccluded condition, and the user may be prompted to re-capture apicture or make replacement, in some embodiments, to improveintelligence of the electronic device, reconstruction is performed basedon a currently captured image, and an replacement image after thereconstruction is unoccluded. For example, because a lighting problem,when the user is near a window, a strong light whitening phenomenonoccurs on a side of the face as if there is an occlusion for anelectronic device. If the electronic device in an automaticreconstruction mode, an image of the face on the side where strong lightoccurs is automatically reconstructed according to the other side of theface of the user that is not near the window and based on a symmetricalrelationship of the face, so as to provide a picture that meetsrequirements, to prevent adjustment and capturing from being repeatedlyperformed by the user, thereby further improving intelligence and usersatisfaction.

Optionally, the determining, according to an occluded status of thetarget image, whether an unoccluded replacement image can bereconstructed includes:

according to symmetry of the target object, reconstructing, if one oftwo symmetrical detection regions is occluded, the target image based onan unoccluded detection region symmetrical to the occluded detectionregion, to generate the replacement image.

During automatic reconstruction, not all target images can bereconstructed, and merely some occluded images can be reconstructed. Forexample, the target object is a face. The face is symmetrical, andreconstruction can be performed when only one part of any twosymmetrical parts is occluded. Otherwise, it is impossible to preciselyperform reconstruction. Therefore, in some embodiments, occlusiondetection is performed based on each detection region, and if twodetection regions are symmetrical, and one of the detection regions areoccluded, reconstruction can be performed based on another detectionregion. For example, a face is used as an example, a left cheek regionserves as a left cheek detection region, a right cheek serves rightcheek detection region, and the left cheek detection region and theright cheek detection region are symmetrical to each other. If the leftcheek detection region is occluded, but the right cheek detection regionis unoccluded, an image of left cheek detection region can bereconstructed directly based on image data of the right cheek detectionregion, so as to obtain an unoccluded replacement image to replace acorresponding operation performed by the target object, for example,transmission to a peer end device.

As shown in FIG. 8, some embodiments provide an apparatus for occlusiondetection on a target object, including:

a first determining unit 110, configured to determine, based on a pixelvalue of each pixel in a target image, first positions of a firstfeature and second positions of a second feature in the target image,the first feature being an outer contour feature of a target object inthe target image, the second feature being a feature of an interferingsubobject in the target object, and the interfering subobject being asubobject that interferes with occlusion detection and that is in thetarget object;

a second determining unit 120, configured to determine, based on thefirst positions, an image region including the target object;

a division unit 130, configured to divide, based on the secondpositions, the image region into at least two detection regions; and

a third determining unit 140, configured to determine, according to atleast some pixel values of each detection region, whether the presetunoccluded condition is met in each detection region, the thirddetermining unit being configured to determine, for a target detectionregion, whether the target detection region meets the preset unoccludedcondition according to a pixel value of the target detection region, andthe target detection region being any one of the at least two detectionregions; and

a fourth determining unit 150, configured to determine that there is anocclusion in a corresponding detection region when the preset unoccludedcondition is not met, the fourth determining unit being configured todetermine, for the target detection region, that there is an occlusionin the target detection region if it is determined that the targetdetection region does not meet the preset unoccluded condition.

The first determining unit 110, the second determining unit 120, thedivision unit 130, the third determining unit 140, and the fourthdetermining unit 150 provided by some embodiments all correspond to aprocessor or processing circuit. The processor may include a centralprocessing unit (CPU), a micro-controller unit (MCU), a digital signalprocessor (DSP), an application processor (AP), or a programmable logiccontroller (PLC). The processing circuit may be an application-specificintegrated circuit (ASIC) or the like. The processor or processingcircuit may be configured to execute computer-executable code, such as acomputer program, to implement a function of each unit.

In some embodiments, the apparatus for occlusion detection on a targetobject may be applied to a network-side server or be applied to aterminal capturing the target image. The server may be a cloud server orthe like in various cloud platforms. The terminal may include a mobileterminal or a fixed terminal. A typical mobile terminal may include: amobile phone, a tablet computer, a wearable device, or a portableterminal device such as a notebook computer. The fixed terminal mayinclude a terminal device such as a desktop computer.

The apparatus for occlusion detection on a target object provided bysome embodiments can first determine, extraction of position informationof feature points of a target object, an image region including thetarget object, then, perform detection region division based on positioninformation of an interfering subobject that is likely to interfere withocclusion detection in the target object, and then, determine anoccluded status in each detection region one by one, and compared withrepeated iterative determining, has features such as a small calculationamount and low calculation complexity, And has a feature of highdetection precision because of region division for detection.

Optionally, the division unit 130 is configured to connect the secondpositions in series, to form at least two detection regions that areclosed and do not include the interfering subobject.

In some embodiments, for further precise determining, a partial imagecorresponding to the interfering subobject may be taken off frame thedetection region. In this way, each detection region is prevented frominterference of an interfering subobject of the target object onocclusion detection, so that determining precision may be furtherimproved.

Optionally, the apparatus further includes:

an obtaining unit, configured to obtain attribute information of thetarget object, where the attribute information includes overallattribute information and/or regional attribute information, the overallattribute information is used to represent an overall attribute of thetarget object, and the regional attribute information is used torepresent a regional attribute of the detection region;

the fourth determining unit is configured to determine, according to theattribute information, a determining basis parameter and/or adetermining policy, and

the third determining unit 140 is specifically configured to perform oneof the following:

determining, according to the determining basis parameter and the pixelvalue of the target detection region, whether the target detectionregion meets the preset unoccluded condition; and

determining, based on the pixel value of the target detection region,whether the target detection region meets the preset unoccludedcondition by using the determining policy.

In some embodiments, the apparatus further includes: the obtaining unitand the fourth determining unit. The obtaining unit and the fourthdetermining unit both correspond to a processor or a processing circuit.Refer to the foregoing corresponding part for detailed description onthe processor or processing circuit. Details are not described hereinagain.

In some embodiments, by obtaining overall attribute information and/orregional attribute information, the obtaining unit obtains, according toa correspondence between attribute information and a determining basisparameter and a determining policy, a determining basis parameter and/ora determining policy suitable for the target detection region. In someembodiments, alternatively, the attribute information may be input to aspecial model, a determining basis parameter and/or a determining policymatching the overall attribute information is output by the specialmodel.

Optionally, the determining unit 140 is further configured to: determinea detection ratio of a quantity of pixels that are in the targetdetection region and that have pixel values in a same range to a totalquantity of all pixels in the target detection region; compare thedetection ratio with a preset ratio of the target detection region; anddetermine that there is an occlusion in the target detection region ifthe detection ratio is less than the preset ratio. Different detectionregion may correspond to a same preset ratio. In some embodiments,preferably, different detection regions correspond to different presetratios, to set preset ratios specifically according to differentfeatures of different detection regions. The preset ratio herein may bean empirical value and/or a simulation value, thereby improvingdetermining precision of a single detection region and improvingdetermining precision of an entire image region.

Optionally, the third determining unit 140 may be specificallyconfigured to perform at least one of the following: obtaining, based ona pixel value of an edge pixel of the target detection region, a shapefeature of the target detection region, and determining whether theshape feature corresponds to a preset shape; and determining, based on apixel value of each pixel in the target detection region, a colorfeature in the target detection region, and determining whether thecolor feature meets a preset color condition.

Further, the apparatus further includes:

an output unit, at least configured to perform at least one of thefollowing:

outputting, according to an occluded detection region, an adjustmentprompt corresponding to the detection region if the electronic device isin a capturing mode of capturing the target image and detects that thetarget object is occluded; and

outputting a replacement prompt for the target image if the electronicdevice is in a non-capturing mode and detects that the target object isoccluded.

The output unit may correspond to a display output unit such as adisplay, and is configured to display and output the adjustment promptand/or replacement prompt. In some embodiments, the output unit mayinclude a voice output unit such as speaker. The voice output unit maybe configured to output the foregoing adjustment prompt and/orreplacement prompt in a voice form.

Optionally, the apparatus further includes:

a construction unit, configured to determine, according to an occludedstatus of the target image, whether an unoccluded replacement image canbe reconstructed based on the target image if the electronic device isin an automatic reconstruction mode and detects that the target objectis occluded; and generate the replacement image based on the targetimage if an unoccluded replacement image can be reconstructed based onthe target image.

In some embodiments, the reconstruction unit may also correspond to aprocessor or a processing circuit, may be configured to reconstruct thetarget image based on attributes, such as symmetry, of the target objectto generate a replacement image capable of replacing an original targetimage, thereby reducing repeated capturing, repeated prompting, or thelike.

Optionally, the reconstruction unit is specifically configured to:according to symmetry of the target object, reconstruct, if one of twosymmetrical detection regions is occluded, the target image based on anunoccluded detection region symmetrical to the occluded detectionregion, to generate the replacement image.

In some embodiments, the target object is a face. The target featureincludes: features of five organs of the face. Five organs of a humanherein may include: eyebrows, eyes, mouth, nose, and ears.

As shown in FIG. 9, some embodiments provides an electronic device,including:

a memory 210, configured to store information; and

a processor 220, connected to the memory and configured to execute acomputer program stored in the memory, so as to perform the method forocclusion detection on a target object according to one or moretechnical solutions.

The memory 210 may include various storage mediums that can beconfigured to store a computer program. The storage medium included bythe memory 210 may include: a non-transitory storage medium, and thenon-transitory storage medium may be configured to store a computerprogram. The storage medium included by the memory 210 may furtherinclude: a storage medium, such as a cache, configured to cache a pixelvalue.

The processor 220 may be connected to a display screen 210 and thememory 210 through a bus 240 such as an integrated circuit IIC bus. Theprocessor 220 may include a processor or a processing circuit such as acentral processing unit, a microprocessor, a digital signal processor,an application processor, or a programmable array, and can be configuredto by executing any one of the foregoing methods for occlusion detectionon a target object by executing the computer program.

Some embodiments further provide a computer storage medium, the computerstorage medium stores a computer program, and after the computer programis executed by a processor, the computer storage medium can perform themethod for occlusion detection on a target object according to theforegoing one or more technical solutions.

In some embodiments, the computer storage medium may be various storagemediums such as a random storage medium, a read-only storage medium, aflash, a removable hard disk, a compact disc, or a magnetic tape, mayselectively be a non-volatile storage medium, and may be applied to astorage medium that still stores computer program after power-down.

Several examples are provided below with reference to any one of theforegoing embodiments:

Example 1

This example provides a set of a method for automatically detecting afacial occlusion, and a method of prompting picture replacement orprompting notes for picture or video shooting when a facial occlusion isdetected.

First, facial detection tagging is performed on an output picture orvideo stream including a face.

After an image region including the face is determined based on thefacial detection tagging, a divided region for occlusion detection isselected for a face tagging result.

Skin tone detection is performed separately on detection regions, andwhether the face in a corresponding detection region is occluded isautomatically determined according to skin tone detection result.

In case of an occlusion, a prompt for picture replacement or headposition adjustment may be provided according to a scenario.

Facial occlusion phenomena in most face scenarios can be effectivelydetected by using the detection method provided in this example, and adetection speed is high.

This example can be applied to scenarios, such as single-picture-basedthree-dimensional facial reconstruction or full-front facephotographing, that needs to quickly perform automatic detection andprompt no facial occlusion.

For example, when a user takes a picture or chooses picture in an albumto perform three-dimensional facial reconstruction, because a facialocclusion (such as hair or a masks) has a relatively large impact on athree-dimensional facial reconstruction effect, before thethree-dimensional facial reconstruction is performed, a facial occlusionmay be detected by using the method of this example. If an occlusion isdetected, the user is prompted, in a manner such as a mobile phoneprompt, to replace a facial picture or adjust a facial photographingposition (remove the occlusion).

The method provided by this example relies on a wide hardwareenvironment and can be used in any hardware device with image processingand image selecting capabilities such as a smartphone, a personalcomputer (PC), or a server.

The following specifically describes how to perform facial detectiontagging.

A facial detection tagging algorithm may be used for the facialdetection tagging. Common algorithms for facial detection tagging areASM, AAM, and cascade regression.

In this example, a class, that is, a random forest manner, in thecascade regression algorithm is used. A main idea includes two stages:

a. Offline training stage: A large quantity of training samples(including facial images and feature point positions manuallycalibrated) for facial tagging are collected, a random forest (which isa term of a machine learning algorithm and is a cascade regressor) isestablished according to an image feature, that is, a LBP of eachpicture point, and machine learning is performed on such a random forestby using the training samples, to obtain specific parameter values ofall nodes in all random forests.

b. Online recognition stage: For a facial image to be tagged, first, allLBP features of the image are calculated, then, the features aredetermined by using the random forests trained before, to obtain finalfeature points.

The following specifically describes how to divide an image region toobtain detection regions.

According to tag points of detected facial features, divided facialocclusion regions are constructed, and each skin tone area threshold iscalibrated according to statistical samples.

a. Advantages of constructing divided facial occlusion regions by usingtag points:

(1) Because eyebrows themselves, eyeballs, nostrils, tongue, and thelike are greatly different in regions at eyebrows, inside eyeballs, atnostrils, and inside mouth, they (e.g., interfering subobjects) arelikely to be incorrectly detected as non-skin tone regions. As a result,an overall occlusion detection effect is affected.

(2) It would be easier to find an occluded status of a local region byperforming divided region detection: for example, only forehead ispartially occluded by hair, and if an overall skin tone area proportionis calculated, a proportion of an occluded region is low, and incorrectdetection is easily caused. If only a skin tone area proportion of aforehead region is calculated, a hair occlusion can be preciselydetected.

Therefore, for most occluded statuses in practice, the following threeocclusion detection regions are determined herein:

(1) Region of forehead-eyebrows-eye lower edges (occluded statusescaused by a fringe of hair, sunglasses, or the like).

(2) Region from a left cheek to a left nostril or a left mouth corner(occluded statuses caused by a mask, left-side long hair, or the like).

(3) Region from a right cheek to a right nostril or a right mouth corner(occluded statuses caused by a mask, right-side long hair, or the like).

b. An occlusion threshold of each region is tagged according tostatistical samples.

Facial picture sampling is performed for various common occludedstatuses and unoccluded statuses herein mainly according to actualsampling. For each picture, facial skin tone area proportions (aquantity of pixels detected to have a skin tone/a total quantity ofpixels of a detection region) of the three regions are separatelycalculated, and tolerable minimum occluded skin tone area proportions ofthe respective detection regions are computed as skin tone occlusionthresholds of the detection regions.

The following specifically describe performing occlusion determiningwith reference to skin tone detection, including the following steps.

a. Traverse all pixels in each detection region and perform skin tonedetection on pixel value thereof (RGB space, briefly recorded as (r, g,b) below):

(1) Calculate a skin tone determining parameter 1 (param1):param1=(−176933*r−347355*g+524288*b+134217728)>>20

(2) If param1<=77 or param1>=127, determine a color as a non-skin tone

(2) If 127>param1>77, further calculate the skin tone determiningparameter 2 param2:

param2=(524288*r−439026*g−85262*b+134217728)>>20

If 173>param2>133, determine the color is a skin tone; otherwise,determine the color as a non-skin tone.

Practice has proved that if parameter calculations in this algorithm areused, most lighting statuses, skin tone statuses can be correctlydetected. 20, 77, 127, 133 and 170 herein are all determiningthresholds, and may be one of the foregoing determining basisparameters.

b. Compute a skin tone area proportion in a region: a quantity of allskin tone pixels/a total quantity of pixels of a detection region, andcompare it with an occlusion threshold computed in “b”, where if theproportion is less than the occlusion threshold, it indicates that thereis an occlusion in this region.

Practice has proved that this solution can effectively detect a facialocclusion status, to avoid interference of common error detectionregions such as eyeballs, mouth, and nostrils. In addition, it can belearned from the algorithm of the solution that the entire technicalsolution has a small calculation amount and a high detection speed andis a better facial occlusion detection solution that is accurate andquick.

In some cases, an overall attribute, a regional attribute, and the likeof a target object may be distinguished to set a determining basisparameter. The following describes differences of determining basisparameters by using an example in which the gender is an overallattribute.

Occlusion thresholds of three detection regions (meaning: a quantity ofpixel values detected to be the skin tone/a total quantity of pixels ina detection region):

Detection region 1: corresponding to a region of forehead-eyebrows-eyelower edges. Occluded statuses caused by a fringe of hair, sunglasses,or the like are mainly detected, and occlusion thresholds may be asfollows:

male: 86%-90%;

female: 82%-91%; and

neutral (applicable to an unknown gender): 86%-90%.

Detection region 2: corresponding to a region from a left cheek to aleft nostril or a left mouth corner. Occluded statuses caused by a mask,left-side long hair, or the like are mainly detected, and occlusionthresholds may be as follows:

male: 88.2%-92.7%;

female: 86.4%-92.5%; and

neutral (applicable to an unknown gender): 88%-92%.

Detection region 3: corresponding to a region from a right cheek to aright nostril or a right mouth corner. Occluded statuses caused by amask, right-side long hair, or the like are mainly detected, andocclusion thresholds may be as follows:

male: 88.2%-92.7%;

female: 86.4%-92.5%; and

neutral (applicable to an unknown gender): 88%-92%.

Example 2

As shown in FIG. 10, this example provides another face occlusiondetection method, including:

determining whether a facial picture or an image frame including a faceis input, where the image frame may be a component of a video stream, ifyes, a next step is performed; otherwise, the present step is returnedto;

performing facial detection tagging, specifically including: performingfeature detection on the facial picture or the image frame including aface;

dividing an image region of a face according to tag points to obtaindetection regions, and calibrating a skin tone area threshold of eachdetection region according to statistical samples;

performing skin tone detection on each detection region;

determining whether a detected actual skin tone area is greater than theskin tone area threshold;

determining that the face is unoccluded when detected skin tone areas ofall regions are greater than the area threshold; and

determining that the face is occluded when a detected skin tone area ofat least one detection region is smaller than the skin tone areathreshold.

In the several embodiments provided in the present application, itshould be understood that the disclosed device and method may beimplemented in other manners. The described device embodiments aremerely exemplary. For example, the unit division is merely logicalfunction division and may be other division during actualimplementation. For example, multiple units or components may becombined or integrated into another system, or some features may beignored or not performed. In addition, the displayed or discussed mutualcouplings or direct couplings or communication connections between thecomponents may be implemented through some interfaces, indirectcouplings or communication connections between the devices or units, orelectrical connections, mechanical connections, or connections in otherforms.

The units described as separate parts may or may not be physicallyseparate, and parts displayed as units may or may not be physical units,may be located at one position, or may be distributed on a plurality ofnetwork units. Some or all of the units may be selected according toactual needs to achieve the objectives of the solutions of theembodiments.

In addition, functional units in the embodiments of the presentdisclosure may be all integrated into one processing module, or each ofthe units may be separately independently used as one unit, or two ormore units may be integrated into one unit. The integrated unit may beimplemented in a form of hardware, or may be implemented in a form ofhardware in addition to a software functional unit.

A person skilled in the art can understand that all or some steps forimplementing the foregoing method embodiment may be completed by aprogram instructing related hardware, the foregoing program may bestored in a computer-readable storage medium, and when being executed,the program performs steps including the foregoing method embodiment.The foregoing storage medium includes: any medium that can store programcode, such as a removable storage device, a read-only memory (ROM,Read-Only Memory), a random access memory (RAM, Random Access Memory), amagnetic disk, or a compact disc.

The foregoing descriptions are merely specific implementations of thepresent disclosure, but are not intended to limit the protection scopeof the present disclosure. Any variation or replacement readily figuredout by a person skilled in the art within the technical scope disclosedin the present disclosure shall fall within the protection scope of thepresent disclosure. Therefore, the protection scope of the presentdisclosure shall be subject to the protection scope of the claims.

What is claimed is:
 1. A method for occlusion detection on a targetobject implemented by an electronic device, comprising: determining,based on a pixel value of each pixel in a target image, first positionsof a first feature and second positions of a second feature in thetarget image, the first feature being an outer contour feature of atarget object in the target image, the second feature being a feature ofan interfering subobject in the target object; determining, based on thefirst positions, an image region comprising the target object;connecting multiple pixels of the second positions in series to obtain acontour of the interfering subobject, and removing, according to thecontour of the interfering subobject, the interfering subobject from theimage region, to form at least two detection regions, wherein eachdetection region is closed and excludes the interfering subobject;determining, according to a pixel value of a target detection region,whether the target detection region meets a preset unoccluded condition,the target detection region being any one of the at least two detectionregions and excluding the interfering subobject; determining that thetarget object is occluded when the preset unoccluded conditioncorresponding to any one of the at least two detection regions is notmet; and determining that the target object is not occluded whendetermining that the preset unoccluded condition corresponding to eachof the at least two detection regions is met.
 2. The method according toclaim 1, further comprising: obtaining, by the electronic device,attribute information of the target object, wherein the attributeinformation comprises overall attribute information and regionalattribute information, the overall attribute information represents anoverall attribute of the target object, and the regional attributeinformation represents a regional attribute of the target detectionregion; and determining, by the electronic device according to theattribute information, at least one of a determining basis parameter ora determining policy, wherein the determining whether the targetdetection region meets the preset unoccluded condition comprises atleast one of the following: determining, by the electronic deviceaccording to the determining basis parameter and the pixel value of thetarget detection region, whether the target detection region meets thepreset unoccluded condition; and determining, by the electronic devicebased on the pixel value of the target detection region, whether thetarget detection region meets the preset unoccluded condition by usingthe determining policy.
 3. The method according to claim 2, wherein thedetermining, by the electronic device according to the determining basisparameter and the pixel value of the target detection region, whetherthe target detection region meets the preset unoccluded conditioncomprises: determining, by the electronic device, a detection ratio of aquantity of pixels that are in the target detection region and that havepixel values in a same range to a total quantity of all pixels in thetarget detection region; comparing, by the electronic device, thedetection ratio with a preset ratio of the target detection region; anddetermining that the target detection region does not meet the presetunoccluded condition if the detection ratio is less than the presetratio.
 4. The method according to claim 2, wherein the determining, bythe electronic device based on the pixel value of the target detectionregion, whether the target detection region meets the preset unoccludedcondition by using the determining policy comprises at least one of thefollowing: obtaining, by the electronic device based on pixel values ofedge pixels of the target detection region, a shape feature of thetarget detection region, and determining whether the shape featurecorresponds to a preset shape; and determining, by the electronic devicebased on a pixel value of each pixel in the target detection region, acolor feature in the target detection region, and determining whetherthe color feature meets a preset color condition.
 5. The methodaccording to claim 1, wherein the method further comprises at least oneof the following: when the electronic device is in a capturing mode ofcapturing the target image and detects that the target object isobstructed, outputting an adjustment prompt corresponding to the targetdetection region that does not meet the preset unoccluded condition; andoutputting a replacement prompt for the target image when the electronicdevice is in a non-capturing mode and detects that the target object isobstructed.
 6. The method according to claim 1, further comprising:determining, by the electronic device according to an occluded status ofthe target image, that an unoccluded replacement image can bereconstructed based on the target image if the electronic device is inan automatic reconstruction mode and detects that the target object isoccluded; and generating, by the electronic device, the replacementimage based on the target image.
 7. The method according to claim 6,wherein; the at least two detection regions include two symmetricaldetection regions; and the generating, by the electronic device, thereplacement image based on the target image comprises: reconstructing,by the electronic device if one of the two symmetrical detection regionsis occluded and the other one of the two symmetrical detection regionsis not occluded, the target image based on the other one of the twosymmetrical detection regions, to generate the replacement image.
 8. Themethod according to claim 1, wherein the target object is a face; andthe second feature comprises: features of organs of the face.
 9. Themethod according to claim 1, further comprising: obtaining a dividingline by connecting the multiple pixels of the second positions inseries; and combining the dividing line and an edge line of the imageregion to obtain the at least two closed detection regions that excludesthe interfering object.
 10. An apparatus for occlusion detection on atarget object, comprising: a memory; and a processor coupled to thememory and configured to: determine, based on a pixel value of eachpixel in a target image, first positions of a first feature and secondpositions of a second feature in the target image, the first featurebeing an outer contour feature of a target object in the target image,the second feature being a feature of an interfering subobject in thetarget object; determine, based on the first positions, an image regioncomprising the target object; connecting multiple pixels of the secondpositions in series to obtain a contour of the interfering subobject,and removing, according to the contour of the interfering subobject, theinterfering subobject from the image region, to form at least twodetection regions, wherein each detection region is closed and excludesthe interfering subobject; determine, according to a pixel value of atarget detection region, whether the target detection region meets apreset unoccluded condition, the target detection region being any oneof the at least two detection regions and excluding the interferingsubobject; determine that the target object is occluded when the presetunoccluded condition corresponding to any one of the at least twodetection regions is not met; and determine that the target object isnot occluded when determining that the preset unoccluded conditioncorresponding to each of the at least two detection regions is met. 11.The apparatus according to claim 10, wherein the processor is furtherconfigured to: obtain attribute information of the target object,wherein the attribute information comprises overall attributeinformation and regional attribute information, the overall attributeinformation represents an overall attribute of the target object, andthe regional attribute information represents a regional attribute ofthe target detection region; and determine, according to the attributeinformation, at least one of a determining basis parameter or adetermining policy, and the processor is specifically configured toperform one of the following: determining, according to the determiningbasis parameter and the pixel value of the target detection region,whether the target detection region meets the preset unoccludedcondition; and determining, based on the pixel value of the targetdetection region, whether the target detection region meets the presetunoccluded condition by using the determining policy.
 12. The apparatusaccording to claim 11, wherein the processor is further configured to:determine a detection ratio of a quantity of pixels that are in thetarget detection region and that have pixel values in a same range to atotal quantity of all pixels in the target detection region; compare thedetection ratio with a preset ratio of the target detection region; anddetermine that the target detection region does not meet the presetunoccluded condition if the detection ratio is less than the presetratio.
 13. The apparatus according to claim 11, wherein the processor isfurther configured to perform at least one of the following: obtain, bythe electronic device based on pixel values of edge pixels of the targetdetection region, a shape feature of the target detection region, anddetermine whether the shape feature corresponds to a preset shape; anddetermine, based on a pixel value of each pixel in the target detectionregion, a color feature in the target detection region, and determinewhether the color feature meets a preset color condition.
 14. Theapparatus according to claim 10, wherein the processor is furtherconfigured to perform at least one of the following: when the electronicdevice is in a capturing mode of capturing the target image and detectsthat the target object is obstructed, outputting an adjustment promptcorresponding to the target detection region that does not meet thepreset unoccluded condition; and outputting a replacement prompt for thetarget image when the electronic device is in a non-capturing mode anddetects that the target object is obstructed.
 15. The apparatusaccording to claim 10, wherein the processor is further configured to:determine, according to an occluded status of the target image, that anunoccluded replacement image can be reconstructed based on the targetimage if the electronic device is in an automatic reconstruction modeand detects that the target object is occluded; and generate thereplacement image based on the target image.
 16. The apparatus accordingto claim 15, wherein; the at least two detection regions include twosymmetrical detection regions; and the processor is further configuredto: reconstruct, if one of the two symmetrical detection regions isoccluded and the other one of the two symmetrical detection regions isnot occluded, the target image based on the other one of the twosymmetrical detection regions, to generate the replacement image. 17.The apparatus according to claim 10, wherein: the target object is aface; and the second feature comprises: features of organs of the face.18. The apparatus according to claim 10, wherein the processor isfurther configured to: obtain a dividing line by connecting the multiplepixels of the second positions in series; and combine the dividing lineand an edge line of the image region to obtain the at least two closeddetection regions that excludes the interfering object.
 19. Anon-transitory computer-readable storage medium, storing a computerprogram, the computer program, when being executed by a processor,causing the processor to perform: determine, based on a pixel value ofeach pixel in a target image, first positions of a first feature andsecond positions of a second feature in the target image, the firstfeature being an outer contour feature of a target object in the targetimage, the second feature being a feature of an interfering subobject inthe target object; determining, based on the first positions, an imageregion comprising the target object; connecting multiple pixels of thesecond positions in series to obtain a contour of the interferingsubobject, and removing, according to the contour of the interferingsubobject, the interfering subobject from the image region, to form atleast two detection regions, wherein each detection region is closed andexcludes the interfering subobject; determining, according to a pixelvalue of a target detection region, whether the target detection regionmeets a preset unoccluded condition, the target detection region beingany one of the at least two detection regions and excluding theinterfering subobject; determining that the target object is occludedwhen the preset unoccluded condition corresponding to any one of the atleast two detection regions is not met; and determining that the targetobject is not occluded when determining that the preset unoccludedcondition corresponding to each of the at least two detection regions ismet.
 20. The storage medium according to claim 19, wherein the computerprogram further cause the processor to perform: obtaining a dividingline by connecting the multiple pixels of the second positions inseries; and combining the dividing line and an edge line of the imageregion to obtain the at least two closed detection regions that excludesthe interfering object.